<template>
    <view class="warp">
        <view class="box">
            <t-table @change="change">
                <t-tr class="has-bg-white">
                    <t-th>阶梯</t-th>
                    <t-th>业绩流水（万）</t-th>
                    <t-th>返点（每一万业绩）</t-th>
                    <t-th>佣金（￥）</t-th>
                </t-tr>
                <t-tr v-for="item in tableList" :key="item.id">
                    <t-td>{{ item.order }}</t-td>
                    <t-td>{{ item.order_num }}</t-td>
                    <t-td>{{ item.order_rebate }}</t-td>
                    <t-td>{{ item.rebate_num }}</t-td>
                </t-tr>
            </t-table>
        </view>
    </view>
</template>

<script>
	    import tTable from '@/components/t-table/t-table.vue';
	    import tTh from '@/components/t-table/t-th.vue';
	    import tTr from '@/components/t-table/t-tr.vue';
	    import tTd from '@/components/t-table/t-td.vue';
		var _self;
	    export default {
	        components: {
	            tTable,
	            tTh,
	            tTr,
	            tTd
	        },
	        data() {
	            return {
					foxtel:'',
	                tableList: []
	            };
	        },
			onLoad(){
				_self = this;
				this.getreturn();
			},
	        methods: {
	            change(e) {
	                console.log(e.detail);
	            },
	            edit(item) {
	                uni.showToast({
	                    title: item.name,
	                    icon: 'none'
	                });
	            },
				getreturn(){
					let info = this.service.getfox();
					if(info[0]){
						let user_tel = info[0]['foxtel'];
						this.foxtel = user_tel;
						// console.log(user_tel)
						uni.request({
							url: this.service.FOX_URL + 'diamond/get_rebate',
							method:'POST',
							data: {
								user_tel: user_tel
							},
							dataType:'json',
							header:{
								'content-type':'application/x-www-form-urlencoded',
							},
							success: res => {
								var rest = res.data;
								if(rest.code == '200'){
									if(rest.data.list){
										this.tableList = rest.data.list;
									}else{
										uni.showToast({
											title:rest.message,
											icon:'none',
											mask:true
										})
									}
								}else{
									uni.showToast({
										title:'网络异常',
										icon:'none',
									})
								}
							}
						})
					}else{
						uni.reLaunch({
							url:'../logon/login'
						})
					}
				}
	        }
	    };
</script>

<style>
</style>
